/*
 * Task.h
 *
 *  Created on: 19.11.2012
 *      Author: Lapchinskiy
 */

#ifndef TASK_H_
#define TASK_H_
//#include "Global_types.h"
typedef enum {ENABLED, DISABLED}TaskStatus;
class Task {
private:
	static uint8_t taskCounter;
	uint8_t id;
	Condition<uint32_t> *conditionToRun;
	ErrorCode (*callbackFunc)(void *args);
	void *callbackArgs;
	Task *nextTask;
	ErrorCode errorCode;
	TaskStatus status;
#ifdef GLOBAL_LOGGING_ENABLE
		static ModuleType moduleType;
		LogRecord logrec;
#endif //GLOBAL_LOGGING_ENABLE


public:

	Task();
	Task(char* name, ErrorCode (*callBack)(void *args),void *args, TaskStatus enabled);
	Task(char* name, ErrorCode (*callBack)(void *args),void *args, Condition<uint32_t> *conditonToRun, TaskStatus enabled);
	ErrorCode addNextTask(Task *nextTask);
	ErrorCode Enable(void);
	ErrorCode Disable(void);
	TaskStatus GetStatus(void);
	Task* run();
	~Task();
};





#endif /* TASK_H_ */
